package com.wzgl.core.server;

import com.jfinal.aop.Before;
import com.jfinal.kit.Ret;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.tx.Tx;
import com.wzgl.core.model.TfinishUrl;
import com.wzgl.core.utils.UuidUtil;



public class FinishurlService {
	public final static FinishurlService me = new FinishurlService();
	
	@Before(Tx.class)
	public boolean update(TfinishUrl t)throws Exception{
		boolean b = false;
		try {
			if(StrKit.isBlank(t.getFid())){
				b = false;
			}else{
				b = t.update();
			}
		} catch (Exception e) {
			b = false;
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return b;
	}
	
	@Before(Tx.class)
	public Ret save(TfinishUrl ts){
		ts.setFid(UuidUtil.get32UUID());
		if(ts.save()){
			ts.putCache(ts.getFid(), ts);
			return Ret.ok();
		}else{
			return Ret.fail();
		}
	}
}
